#version 330 core

uniform mat4 mvpMatrix;
mat3 nMatrix = mat3(1.0, 0.0, 0.0,
					0.0, 1.0, 0.0,
					0.0, 0.0, 1.0);

vec3 camPosition = vec3(0.0, 0.0, 100.0);

in vec3 position;
in vec3 normal;
in vec4 color;

out vec4 outColor;


void main(void)
{
	outColor = color;

	vec3 eyeNormal = normalize(nMatrix * normal);
    vec3 lightPosition = camPosition;
    vec4 diffuseColor = color;
    
    float nDotVP = max(0.0, dot(eyeNormal, normalize(lightPosition)));
    
    outColor.rgb = color.rgb * nDotVP;
    outColor.a = color.a;
    
    gl_Position = mvpMatrix * vec4(position, 1.0);
}